package com.demo.Test;

import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;

import java.io.File;

public class Test10 {

    public static void main(String[] args) {
        String[] titleA = {"id", "sgonghao", "cname"};
        File file = new File("test2.xls");
        try{
            file.createNewFile();
            WritableWorkbook workbookA = Workbook.createWorkbook(file);
            WritableSheet sheetA = workbookA.createSheet("sheet1", 0);
            Label labelA= null;
            for(int i=0; i<titleA.length; i++){
                labelA = new Label(i, 0, titleA[i]);
                sheetA.addCell(labelA);
            }
            for(int i=1; i<10; i++){
                labelA = new Label(0, i, i + " ");
                sheetA.addCell(labelA);
                labelA = new Label(1, i, "20201112"+i);
                sheetA.addCell(labelA);
                labelA = new Label(2, i, "开发00"+i);
                sheetA.addCell(labelA);
            }
            workbookA.write();
            workbookA.close();
        }catch (Exception e){

        }
    }
}
